home *** CD-ROM | disk | FTP | other *** search
-
- /*Drag and drop for AWeb
- $VER: DropZone 1.2 (30.9.99)
- William Parker <bill@amitrix.com>
- Beta, do not distribute*/
-
- trace('E')
- options results
-
- if ~show('L','rexxsupport.library') then
- if ~addlib('rexxsupport.library',0,-30,0) then
- call exit(20)
-
- if show('P','AWEBDROPZONE') then do
- address AWEBDROPZONE 'front'
- exit
- end
-
- parse source . . called .
- c_dir=path(called)
- ports = show('P')
- parse var ports dummy 'AWEB.' portnr .
- address value 'AWEB.' || portnr
-
- parse upper arg mode
- newwindow=0
- tofront=0
- child=0
- tempname=''
- call buildgui()
- call mainloop()
-
- exit
-
-
- buildgui:
- if exists('env:aweb3') then envname='aweb3'
- else envname='aweb3se'
- if(open(env,'env:'envname'/dzwindow','R')) then do
- windows=readln(env)
- newwindow=readln(env)
- tofront=readln(env)
- child=readln(env)
- call close(env)
- parse var windows wl wt ww wh .
- windows= 'top' wt 'left' wl 'width' ww 'height' wh
- end
- else windows='tl width 100 height 100'
-
- if Showlist('H', 'AWNPIPE') then res=open(ca,"awnpipe:dz/-2010/xc")
- if res ~= 1 then do
- 'request nowait "DropZone Error"
- "To use this program you need AWNPipe:*n
- (Vers 2.10 or newer). *n
- Install AWeb 3.3SE from the AWeb install script*n
- or click on the CLICK ME icon in the AWeb drawer." "OK"'
- exit 0
- end
-
- call topipe('"AWeb Drop Zone" sk v m ii awebpath:aweb-II it DropZone ig app si 'windows' defaultgadgets bf awebpath:docs/awebbg.iff')
- call topipe('button b 0 ro gt " " weiw 0 weih 0')
- call topipe('Menu gt "Project|Window|$@SSnapshot|$@UUnsnapshot|@DDrop Zone Docs|@AAbout|@QQuit"')
- call topipe('Menu gt "Settings|^%Open New Window|^%Screen to Front|^%Show Child Drawers"')
- call topipe('ARexx gt "AWEBDROPZONE|front|quit|close"')
- call topipe('open')
- abouttx='Drop Zone for AWeb 3.3*nVers 1.2*nAuthor William Parker*nGUI by AWNPipe:'
- noawebtx=' AWeb not Found *n Start AWeb and retry '
- if tofront~=0 then call topipe('id 3 tar 1 s 1')
- if child~=0 then call topipe('id 3 tar 2 s 1')
- if envname='aweb3se' then topipe('id 3 tar 0 dis 1')
- else if newwindow~=0 then call topipe('id 3 tar 0 s 1')
- if left(mode,1)='I' then do
- in2=1
- call iconify()
- end
-
- return
-
- closegad:
- /*call setenv()*/
- return
-
- setenv:
- if ~exists('env:'envname) then makdir('env:'envname)
- call writeln(ca,'id 0 read')
- windowr=readln(ca)
- parse var windowr wl wt ww wh .
- if (datatype(wt,N) &datatype(wl,N) &datatype(ww,N) & datatype(wh,N) ) then do
- windows= 'top' wt 'left' wl 'width' ww 'height' wh
- call open(env,'env:'envname'/dzwindow','W')
- call writeln(env,windowr)
- call writeln(env,newwindow)
- call writeln(env,tofront)
- call writeln(env,child)
- call close(env)
- end
- return(0)
-
- setenvarc:
- call setenv()
- if ~exists('envarc:'envname) then makdir('envarc:'envname)
- address command 'copy env:'envname'/dzwindow envarc:'envname'/dzwindow >nil:'
- return
-
- unsetenvarc:
- call setenv()
- if exists('envarc:'envname'/dzwindow') then delete('envarc:'envname'/dzwindow')
- if exists('env:'envname'/dzwindow') then delete('env:'envname'/dzwindow')
- return
-
- menu:
- select
- when in2=0 then do
- if in3=0 then do
- if in4=0 then call setenvarc()
- if in4=1 then call unsetenvarc()
- end
- if in3=1 then do
- in2=c_dir'dropzone_doc.html'
- call app2()
- in2=0
- end
- if in3=2 then call showtx(500,abouttx)
- if in3=3 then do
- call closegad()
- exit
- end
- end
- when in2=1 then do
- if in3=0 then newwindow=in5
- if in3=1 then tofront=in5
- if in3=2 then child=in5
- end
-
- otherwise
- end
-
- return
-
-
- showtx:
- call open(ptx,'awnpipe:/xc')
- call writeln(ptx,'db dg Information q cg ps 'screen' m a so si bf awebpath:docs/awebbg.iff')
- call writeln(ptx,'label gt "'arg(2)'"')
- call writeln(ptx,'open')
- call writeln(ptx,'tick 'arg(1))
- call close(ptx)
- return(0)
-
-
- mainloop:
- do while ~eof(ca)
- call topipe('con')
- in=readln(ca)
- parse var in in1 in2 in3 in4 in5 .
- select
- when in1='arexx' then call rxhst()
- when in1='menu' then call menu()
- when in1='gadget' then call gadget()
- when in1='close' then call closegad()
- when in1='app' then call app()
- when in1='key' then do
- if in2=223 then do
- in2=c_dir'dropzone_doc.html'
- call app2()
- in2=0
- end
- end
- when in1='iconify' then call iconify()
- otherwise
- end
-
- end
- return
-
- gadget:
- if in2=1 then newwindow= in3
- if in2=2 then tofront= in3
- return
-
- app:
- parse var in . in2
- in2=strip(in2)
- app2:
- ports = show('P')
- parse var ports dummy 'AWEB.' portnr .
- address value 'AWEB.' || portnr
- if portnr='' then do
- call showtx(500,noawebtx)
- return
- end
- 'GET ACTIVEPORT '
- awebhost=result
- address value awebhost
-
- if (right(in2,1)=':' | right(in2,1)='/') then call showdir()
-
- if newwindow~=0 then 'new "file:///'in2'"'
- else 'open reload "file:///'in2'"'
- if tofront~=0 then do
- if newwindow=0 then 'window tofront'
- 'screentofront'
- end
- if show('P','AWEBTOOLBAR') then address AWEBTOOLBAR 'front'
- if tempname~='' then do
- 'wait "file:///'in2'"'
- call delete(tempname)
- tempname=''
- end
- return
-
- iconify:
- if in2=1 then call topipe('id 0 s 32')
- else do
- call topipe('id 0 s 64')
- end
- return
-
- showdir:
- tempname ='t:dzone'time('s')
- if child~=0 then all='all'
- else all=''
- address command 'echo >'tempname' "<html><head><title>Directory of 'in2' </title></head>"'
- address command 'echo >>'tempname' "<body><h1>Directory of' in2 '</h1><pre>"'
- address command 'list >>'tempname' "'in2'" pat ~(#?.info) files 'all' lformat "<a href=*"file:///%p%n*">%p%n</a> <br>"'
- in2=tempname
- return()
-
- topipe:
- parse arg out
- call writeln(ca,out)
- res=readln(ca)
- parse var res res1 res2 res3
- if res1='ok' then return(res2)
- say 'error from: 'out
- say ' responce: ' in
- exit
-
- path:
- parse arg pathf
- dir_pos = max(lastpos('/',pathf),lastpos(':',pathf))
- if dir_pos > 0 then return(left(pathf,dir_pos))
- else return('')
-
- rxhst:
-
- rxcmd=readch(ca,in3)
- if in2>1 then call writeln(ca,"rc 10")
- if in2=0 then do
- call topipe('rc 0 result "Window brought to front"')
- tofront=1
- end
- if in2=1 then do
- call topipe(ca,'rc 0 result "DropZone exiting"')
- end
-
- if tofront=1 then do
- call topipe('id 0 s 67')
- tofront=0
- end
- return
-